<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>TerraceInfo</title>
<link href="styles/general.css" rel="stylesheet" type="text/css" /><link href="styles/main.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/transport.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
     <script type="text/javascript" src="js/sorttable.js"></script>
    <script src="js/utils.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/jquery/jquery-1.3.2.js"></script>
    <script type="text/javascript">
	    function appversiondel(type,id){
			window.location.href="appversion_save.do?type="+type+"&model.id="+id;
		}
		function appversionshow(type,id,appnumber,msg)
		{
			var cpid ="";//、、document.getElementById("cpid").value;
			var categoryparentid = "";//document.getElementById("categoryparentid").value;
			var appName = "";//document.getElementById("appName").value;
			var url="appversion_show.do?type="+type+"&model.id="+id+"&app.appnumber="+appnumber+"&cpid="+cpid+"&categoryparentid="+categoryparentid+"&appName="+appName;
			if(msg){
				url+="&msg="+msg;
			}
			window.location.href=url;
		}
		function offonline(id,appstatus)
		{	
			$.get("appversion_saveoffonline.do?type=offonline&model.id="+id+"&model.appstatus="+appstatus);
		}
		function goback()
		{
			var cpid = document.getElementById("cpid").value;
			var categoryparentid = document.getElementById("categoryparentid").value;
			var appName = document.getElementById("appName").value;
			window.location.href="app_list.do?cpid="+cpid+"&categoryparentid="+categoryparentid+"&appName="+appName;
		}
		function handOut(url){
			document.getElementById("msgDiv").innerHTML="";
			var sWidth, sHeight;
		    sWidth  = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth); 
		    sHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 
		    var bgObj = document.getElementById("bgDiv"); 
		    bgObj.style.position = "absolute";
		    bgObj.style.top = "0";
		    bgObj.style.background = "#817977";
		    bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=40,finishOpacity=60)";
		    bgObj.style.opacity = "0.4";
		    bgObj.style.left = "0";
		    bgObj.style.width = sWidth + "px";
		    bgObj.style.height = sHeight + "px";
		    bgObj.style.zIndex = "10000"; 

		    var msgObj = document.getElementById("msgDiv");
		    msgObj.style.position = "absolute";
		    msgObj.style.left = "40%";
		    msgObj.style.top = "20%";
		    msgObj.style.right = "10%";
		    msgObj.style.marginLeft = "-300px";
		    msgObj.style.marginTop = -75 + document.documentElement.scrollTop + "px";
		    msgObj.style.lineHeight = "25px";
		    msgObj.style.zIndex = "10001";
		    msgObj.style.display="";
		    bgObj.style.display="";
		    $.get(url,function(data){
		    	 document.getElementById("msgDiv").innerHTML=data;
		    });
		}
		function channleSub(){
			var channelids="",
				appversionId = $("#c_appversionId").val(),
				flag=false;
			$.each($("input[name=c_channelid]:checked"),function(i,item){
				channelids+=$(item).val()+",";
				flag=true;
			});
			if(!flag){
				alert("请勾选渠道信息！！");
				return;
			}
			$.get("appversion_channellist.do?type=save&model.id="+appversionId+"&channelids="+channelids,function(data){
				alert("分发成功,请前往渠道包管理界面更新相关信息！！");
				closechannelapp();
			});
		}
		function closechannelapp(){
			$("#bgDiv,#msgDiv").hide();
		}
		function doRecommend(appversionid,recommend){
			$.get("appversion_doRecommend.do?model.id="+appversionid+"&model.recommend="+recommend,function(){
				if(recommend=="1"){
					$("#recommend_span_"+appversionid).html("<a href='javascript:void(0);' onclick='doRecommend("+appversionid+",0)'>取消</a>");
					$("#tuijian_false_"+appversionid).hide();
					$("#tuijian_true_"+appversionid).show();
				}else{
					$("#recommend_span_"+appversionid).html("<a href='javascript:void(0);' onclick='doRecommend("+appversionid+",1)'>置顶</a>");
					$("#tuijian_false_"+appversionid).show();
					$("#tuijian_true_"+appversionid).hide();
				}
			});
		}
	</script>
	<style type="text/css">
	.sale {
		position: relative;
	}
	.sale .i-mark{
            background:url("img/892102_1573916616.png") repeat scroll 0 rgba(0, 0, 0, 0);
            width:20px;
            height:39px;
    		position: absolute;
       		top: -35px;
        	margin-left: -8px;
    }
	</style>
</head>

<body>
	<h1>
         <span class="action-span1"><a href="mainframe.jsp">首页</a></span>
         <span id="search_id" class="action-span1">- 平台接入管理 </span>
    </h1>
    <form name="form1" method="post" action="appversion_index.do" id="form1">
    
    <div class="form-div">
        <div id="Panel1">
            <img height="22" width="26" border="0" alt="SEARCH" src="img/icon_search.gif">
           &nbsp;游戏名称：&nbsp;
            <select name="app.appnumber" id="app.appnumber">
            	<option value="">--请选择--</option>
            <s:iterator value="applist">
            	<option <s:if test="appnumber.equals(app.appnumber)">selected</s:if> value="<s:property value="appnumber" />"><s:property value="appname" /></option>
            </s:iterator>
            </select>
            &nbsp;
            <input type="submit" name="ButtonSearch" value=" 搜索 " id="ButtonSearch" class="button" />
        </div>
    </div>
    </form>
   <!-- start ad menu list -->
    <div class="list-div" id="listDiv">
        <table width="100%" cellspacing="1" cellpadding="2" class="sortable">
            <tbody>
                <tr>
                    <th>--</th>
			        <th>游戏名称</th>
			        <th>发行版本名称</th>
			        <th>发行版本包名</th>
			        <!-- <th>发行版本平台</th> -->
			        <th>推荐</th>
			        <th>状态</th>
			        <th></th>
			        <th>操作</th>
                </tr>
                <s:if test="list.size<=0&&apvmap.size()<=0">
                <tr>
                	<td><a title="添加游戏版本" href="javascript:void(0);" onclick="appversionshow('insert',-1,'<s:property value="app.appnumber" />');"><img src="img/icon_add.gif" /></a></td>
                	<td colspan="7" align="center">无</td>
                </tr>
                </s:if>
                <s:else>
                <s:if test="list.size()>0">
                <s:iterator value="list" status="t" var="k">
                	<tr background="#FFF68F">
                		<td style="background-color: rgb(255, 255, 255);"><s:property value="#t.count" /></td>
                		<td style="background-color: rgb(255, 255, 255);" nowrap="nowrap"><s:iterator value="applist" ><s:if test="appnumber.equals(#k.appnumber)"><s:property value="appname" /></s:if></s:iterator></td>
                		<td style="background-color: rgb(255, 255, 255);" nowrap="nowrap"><div id="tuijian_true_<s:property value="#k.id" />"><div class="sale"><span title="<s:property value="#k.appversionnumber" />"><s:property value="#k.appname" /><span class="i-mark"></span></span></div></div><div style="display: none;" id="tuijian_false_<s:property value="#k.id" />"><span title="<s:property value="#k.appversionnumber" />"><s:property value="#k.appname" /></span></div></td>
  						<td style="background-color: rgb(255, 255, 255);"><s:property value="#k.apppackage" /></td>
  						<!-- <td style="background-color: rgb(255, 255, 255);"><s:property value="#k.terraceInfo" /></td> -->
  						<td style="background-color: rgb(255, 255, 255);">
  						<span id="recommend_span_<s:property value="#k.id" />"><s:if test='"1".equals(#k.recommend)'><a href="javascript:void(0);" onclick="doRecommend(<s:property value="#k.id" />,'0')">取消</a></s:if><s:else><a href="javascript:void(0);" onclick="doRecommend(<s:property value="#k.id" />,'1')">置顶</a></s:else></span>
  						</td>
  						<td style="background-color: rgb(255, 255, 255);">
  						<select onchange="offonline('<s:property value="#k.id"/>',this.value);" width="10px">
	  						<option <s:if test="#k.appstatus==0">selected</s:if> value="0">发布</option>
	  						<option <s:if test="#k.appstatus==1">selected</s:if> value="1">测试</option>
	  						<option <s:if test="#k.appstatus==2">selected</s:if> value="2">开发</option>
  						</select>
					    </td>
  						<td style="background-color: rgb(255, 255, 255);">
  							<a href="javascript:void(0);" onclick="handOut('appversion_showapppoint.do?model.id=<s:property value="#k.id" />&app.appnumber=<s:property value="#k.appnumber" />');" >计费点</a>
  							&nbsp;<a href="app_show1.do?type=appversion&model.appnumber=<s:property value="#k.appnumber"/>&appversionid=<s:property value="#k.id" />">物料</a>
  						</td>
  						<td nowrap="nowrap" align="left" style="background-color: rgb(255, 255, 255);">
						    <s:if test="isUpdate.equals('true')">
							     <a href="javascript:void(0);" onclick="appversionshow('update','<s:property value="#k.id"/>','<s:property value="#k.appnumber"/>')">
							     	<img height="16" width="16" border="0" src="img/icon_edit.gif" alt="编辑"></a>&nbsp;
							     <a href="javascript:void(0);" onclick="if(confirm('警告！！确定要删除吗？')){appversiondel('del','<s:property value="#k.id"/>')}" >
									<img height="16" width="16" border="0" src="img/icon_trash.gif" alt="删除">
								 </a>
							</s:if>
							<s:else>
								<a href="javascript:void(0);" onclick="appversionshow('update','<s:property value="#k.id"/>','<s:property value="#k.appnumber"/>')">
									<img height="16" width="16" border="0" src="img/icon_view.gif" alt="查看">
								</a>   
							</s:else>
							<!-- <a href="javascript:void(0);" onclick="handOut('appversion_channellist.do?model.id=<s:property value="id" />');">
								<img height="16" width="16" border="0" src="img/icon_fenfa.png" alt="分发">
							</a> 
							<s:if test="appfilename!='null'&&appfilename.length()>0">
				                <a href="<%=request.getContextPath() %>/appversion_downApp.do?model.id=<s:property value="id"/>">
				                  <img height="16" width="16" border="0" src="img/icon_download.png" alt="下载">
				                </a>
				            </s:if>-->
						</td>
                	</tr>
                </s:iterator>
                </s:if>
                <s:if test="apvmap.size()>0">
  				<s:iterator value="apvmap" var="map" status="i"> 
  				<s:if test="#map.value.size()>0">
  				<s:iterator value="#map.value" var="mapVal" status="j">
  					<tr>
  						<s:if test="#j.index==0">
  						<td style="background-color: rgb(255, 255, 255);" rowspan='<s:property value="#map.value.size()" />'><s:if test="isUpdate.equals('true')"><a title="添加游戏版本" href="javascript:void(0);" onclick="appversionshow('insert',-1,'<s:property value="appnumber" />');"><img src="img/icon_add.gif" /></a></s:if><s:else>--</s:else></td>
  						<td style="background-color: rgb(255, 255, 255);" nowrap="nowrap" rowspan='<s:property value="#map.value.size()" />'><s:iterator value="applist" ><s:if test="appnumber.equals(#map.key)"><s:property value="appname" /></s:if></s:iterator></td>
  						</s:if>
  						<td style="background-color: rgb(255, 255, 255);" nowrap="nowrap">
  						<div style="display: none;" id="tuijian_true_<s:property value="#mapVal.id" />"><div class="sale"><span title="<s:property value="#mapVal.appversionnumber" />"><s:property value="#mapVal.appname" /><span class="i-mark"></span></span></div></div><div id="tuijian_false_<s:property value="#mapVal.id" />"><span title="<s:property value="#mapVal.appversionnumber" />"><s:property value="#mapVal.appname" /></span></div></td>
  						<td style="background-color: rgb(255, 255, 255);"><s:property value="#mapVal.apppackage" /></td>
  						<!-- <td style="background-color: rgb(255, 255, 255);"><s:property value="#mapVal.terraceInfo" /></td> -->
  						<td style="background-color: rgb(255, 255, 255);">
  							<span id="recommend_span_<s:property value="#mapVal.id" />"><s:if test='"1".equals(#mapVal.recommend)'><a href="javascript:void(0);" onclick="doRecommend(<s:property value="#mapVal.id" />,'0')">取消</a></s:if><s:else><a href="javascript:void(0);" onclick="doRecommend(<s:property value="#mapVal.id" />,'1')">置顶</a></s:else></span>
  						</td>
  						<td style="background-color: rgb(255, 255, 255);">
  						<select onchange="offonline('<s:property value="#mapVal.id"/>',this.value);" width="10px">
	  						<option <s:if test="#mapVal.appstatus==0">selected</s:if> value="0">发布</option>
	  						<option <s:if test="#mapVal.appstatus==1">selected</s:if> value="1">测试</option>
	  						<option <s:if test="#mapVal.appstatus==2">selected</s:if> value="2">开发</option>
  						</select>
					    </td>
  						<td style="background-color: rgb(255, 255, 255);">
  							<a href="javascript:void(0);" onclick="handOut('appversion_showapppoint.do?model.id=<s:property value="#mapVal.id" />&app.appnumber=<s:property value="#mapVal.appnumber" />');" >计费点</a>
  							&nbsp;<a href="app_show1.do?type=appversion&model.appnumber=<s:property value="#mapVal.appnumber" />&appversionid=<s:property value="#mapVal.id" />">物料</a>
  						</td>
  						<td nowrap="nowrap" align="left" style="background-color: rgb(255, 255, 255);">
						   
						    <s:if test="isUpdate.equals('true')">
							     <a href="javascript:void(0);" onclick="appversionshow('update','<s:property value="#mapVal.id"/>','<s:property value="#mapVal.appnumber"/>')">
							     	<img height="16" width="16" border="0" src="img/icon_edit.gif" alt="编辑"></a>&nbsp;
							     <a href="javascript:void(0);" onclick="if(confirm('警告！！确定要删除吗？')){appversiondel('del','<s:property value="#mapVal.id"/>')}" >
									<img height="16" width="16" border="0" src="img/icon_trash.gif" alt="删除">
								 </a>
							</s:if>
							<s:else>
								<a href="javascript:void(0);" onclick="appversionshow('update','<s:property value="#mapVal.id"/>','<s:property value="#mapVal.appnumber"/>')">
									<img height="16" width="16" border="0" src="img/icon_view.gif" alt="查看">
								</a>   
							</s:else>
							<!-- <a href="javascript:void(0);" onclick="handOut('appversion_channellist.do?model.id=<s:property value="id" />');">
								<img height="16" width="16" border="0" src="img/icon_fenfa.png" alt="分发">
							</a> 
							<s:if test="appfilename!='null'&&appfilename.length()>0">
				                <a href="<%=request.getContextPath() %>/appversion_downApp.do?model.id=<s:property value="id"/>">
				                  <img height="16" width="16" border="0" src="img/icon_download.png" alt="下载">
				                </a>
				            </s:if>-->
						</td>
  					</tr>
  				</s:iterator>
  				</s:if>
  				<s:else>
  				<tr>
	  				<td style="background-color: rgb(255, 255, 255);"><s:if test="isUpdate.equals('true')"><a title="添加游戏版本" href="javascript:void(0);" onclick="appversionshow('insert',-1,'<s:property value="#map.key" />');"><img src="img/icon_add.gif" /></a></s:if><s:else>--</s:else></td>
	  				<td style="background-color: rgb(255, 255, 255);" nowrap="nowrap"><s:iterator value="applist" ><s:if test="appnumber.equals(#map.key)"><s:property value="appname" /></s:if></s:iterator></td>
	  				<td style="background-color: rgb(255, 255, 255);text-align: center;" colspan="6">无</td>
  				</tr>
  				</s:else>
  				</s:iterator>
  				</s:if>
  				</s:else>
  </tbody>
  </table>
  </div>
 <!--Bottom开始-->
  
    <script language="JavaScript">

if (document.getElementById("listDiv"))
{
  document.getElementById("listDiv").onmouseover = function(e)
  {
    obj = Utils.srcElement(e);

    if (obj)
    {
      if (obj.parentNode.tagName.toLowerCase() == "tr") row = obj.parentNode;
      else if (obj.parentNode.parentNode.tagName.toLowerCase() == "tr") row = obj.parentNode.parentNode;
      else return;

      for (i = 0; i < row.cells.length; i++)
      {
        if (row.cells[i].tagName != "TH") row.cells[i].style.backgroundColor = '#eeeded';
      }
    }

  }

  document.getElementById("listDiv").onmouseout = function(e)
  {
    obj = Utils.srcElement(e);

    if (obj)
    {
      if (obj.parentNode.tagName.toLowerCase() == "tr") row = obj.parentNode;
      else if (obj.parentNode.parentNode.tagName.toLowerCase() == "tr") row = obj.parentNode.parentNode;
      else return;

      for (i = 0; i < row.cells.length; i++)
      {
          if (row.cells[i].tagName != "TH") row.cells[i].style.backgroundColor = '#FFF';
      }
    }
  }

}
    </script>
    
<div id="footer">
<br />
<s:property value="bottom"/></div>
    <!--Bottom结束-->
    <div id="msgDiv" style="display:none;"></div>
<div id="bgDiv" style="display:none;" onclick="closachannelapp();"></div>
</body>
</html>